package com.example.demo.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

//@Component
public class HomeRouter {
    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(r -> r.path("/")
                        .filters(f -> f.addRequestHeader("HelloKey", "WorldValue"))
                        .uri("https://www.baidu.com/"))
                .build();
    }
}